Replication Materials for "Resources and Territorial Claims: Domestic Opposition to Resource-Rich Territory"
Soyoung Lee

There are 2 R scripts files in this repository. 

1. rscript-makedata-combined.R: 

This R script cleans raw data and generates the main data used for reproducing the results in the article and the appendix. This script will generate five .csv files used for analysis: 
- main-gridyear.csv  
- main-grid.csv
- dyad-grid.csv
- vdem_SA.csv
- dyad-year-gridcell.csv


2. rscript-analysis.R:

This script contains the code to reproduce all the tables and figures used in the main text and appendix.
The five .csv files used for analysis listed above are pre-generated in the repository, so if you wish to skip the data cleaning process and head straight to replicating the results, you can run this script directly without going through step 1. 

** Warnings ** 
- Be advised that some of the spatial analyses can take hours to run. 
- Using the R package "conleyreg v.0.1.7" can scramble the data inputs, so you must delete and reload the data after running a conleyreg regression. Detailed explanations and reloading code are all inside in the Rscript (you do not need to do anything manually, just be sure to read the comments when running the script and try to run the script in order if possible) 


3. Other GIS shape files included: 

- rexport.shp: The gridcell shapefile needed to construct the neighboring matrix for spatial regression. Do not delete the auxiliary shapefiles such as .cpg, .dbf, that come with this file because they are needed to open the shapefile.  

-SAclaims.shp: Geocoded data on territorial claims in South America 1830-2001. Same warnings apply.  